package cn.xuguowen.user.designPatten.chain_of_responsibility.heima;

/**
 * ClassName: Handler
 * Package: cn.xuguowen.user.designPatten.chain_of_responsibility.heima
 * Description: 抽象处理者
 *
 * @Author 徐国文
 * @Create 2023/6/2 17:03
 * @Version 1.0
 */
public abstract class Handler {

    // ctrl + shift + u 切换大小写
    protected final static Long NUM_ONE = 1L;
    protected final static Long NUM_THREE = 3L;
    protected final static Long NUM_SEVEN = 7L;

    /**
     * 请假开始天数
     */
    protected Long numStart;
    /**
     * 请假结束天数
     */
    protected Long numEnd;
    /**
     * 后继处理者
     */
    protected Handler nextHandler;

    public Handler(Long numStart, Long numEnd) {
        this.numStart = numStart;
        this.numEnd = numEnd;
    }

    public void setNextHandler(Handler nextHandler) {
        this.nextHandler = nextHandler;
    }

    /**
     * 处理请假
     * @param leaveRequest
     */
    protected abstract void handler(LeaveRequest leaveRequest);

    protected final void submit(LeaveRequest leaveRequest) {
        // 处理请假
        this.handler(leaveRequest);
    }
}
